<template>
     <div class="tabber">
      <van-tabbar v-model="active">
        <van-tabbar-item icon="home-o" to="/">首页</van-tabbar-item>
        <van-tabbar-item icon="goods-collect-o">专题</van-tabbar-item>
        <van-tabbar-item icon="apps-o" to="/category">分类</van-tabbar-item>
        <van-tabbar-item icon="shopping-cart-o">购物车</van-tabbar-item>
        <van-tabbar-item icon="user-o">我的</van-tabbar-item>
      </van-tabbar>
    </div>
</template>

<script>
export default {
    data() {
        return {
            active: 0
        }
    },
    mounted(){
        switch(this.$route.path){
            case "/" : this.active = 0
            break;
            case "/category" : this.active = 2
            break;
            default : this.active = 0
            break;
        }
    }
}
</script>

<style lang="less" scoped>
  .tabber {
    margin-top: 50px;
  }
</style>